//
//  AFConversationViewController.m
//  AFChat
//
//  Created by Void on 2018/6/21.
//  Copyright © 2018年 afei. All rights reserved.
//

#import "AFConversationViewController.h"

#import "AFAddMenuView.h"

@interface AFConversationViewController ()

@property (nonatomic, strong) UITableView *tableView;

@property (nonatomic, strong) AFAddMenuView *addMenuView;
@end

@implementation AFConversationViewController

- (id)init {
    if (self = [super init]) {
        initTabBarItem(self.tabBarItem, LOCSTR(@"微信"), @"tabbar_mainframe", @"tabbar_mainframeHL");
    }
    return self;
}


- (void)loadView {
    [super loadView];
    [self p_setNavTitleWithStatusString:nil];
    
//    [self p_loadUI];
//
//    [self p_initListModule];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

#pragma mark - private Method
- (void)p_setNavTitleWithStatusString:(NSString *)statusString {
    NSString *title = LOCSTR(@"微信");
    title = statusString.length > 0 ? [title stringByAppendingFormat:@"(%@)",statusString] : title;
    [self.navigationItem setTitle:LOCSTR(title)];
}

- (void)p_loadUI {
    
    self.tableView = self.view.addTableView(1)
    .backgroundColor([UIColor whiteColor])
    .tableFooterView([UIView new])
    .separatorStyle(UITableViewCellSeparatorStyleNone)
    .masonry(^ (MASConstraintMaker *make) {
        make.edges.mas_equalTo(0);
    })
    .view;
    
    // 下拉logo
    self.tableView.addImageView(1001)
    .image([UIImage imageNamed:@"conv_wechat_icon"])
    .masonry(^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.tableView);
        make.bottom.mas_equalTo(self.tableView.mas_top).mas_offset(-35);
    });
    
    TLWeakSelf(self);
    [self addRightBarButtonWithImage:[UIImage imageNamed:@"nav_add"] actionBlick:^{
        TLStrongSelf(weakself);
        if (strongweakself.addMenuView.isShow) {
            [strongweakself.addMenuView dismiss];
        }else {
            [strongweakself.addMenuView showInView:strongweakself.navigationController.view];
        }
    }];
    
}

- (void)p_initListModule {
    
}

#pragma mark - Getter/Setter

- (AFAddMenuView *)addMenuView {
    if (!_addMenuView) {
        _addMenuView = [[AFAddMenuView alloc] init];
    }
    return _addMenuView;
}



@end
